package com.bestdo;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.file.Paths;
import java.util.HashMap;

import com.sevenchildren.framework.util.JacksonUtils;

public class TT {
	public static void main(String[] args) throws IOException {
		FileInputStream fis = new FileInputStream(Paths.get("/Users/zhaokuner/Desktop/ctrl-access.log").toFile());
		BufferedReader br = new BufferedReader(new InputStreamReader(fis));
		HashMap<String, Integer> map = new HashMap<>();
		String s = br.readLine();
		while (null != s) {

			CtrlLog cl = JacksonUtils.readValue(s, CtrlLog.class);

			if (map.containsKey(cl.getReqIp())) {
				map.put(cl.getReqIp(), map.get(cl.getReqIp()) + 1);
			} else {
				map.put(cl.getReqIp(), 1);
			}

			s = br.readLine();
		}
		map.forEach((a, b) -> {
			System.out.println(a + " " + b + "次");
		});
	}
}
